<template>
  <el-col :span="col">
    <el-card class="box-card" :style="cardStyle">
      <div slot="header" class="clearfix" v-if="title">
        <span>{{title}}</span>
        <template v-if="saveButton && saveButton.length > 0">
          <el-button
            v-if="ifbutton"
            icon="el-icon-check"
            size="mini"
            style="float: right; padding: 6px 9px"
            type="primary"
            @click="$emit('saveClick')"
          >{{ saveButton }}</el-button>
        </template>
      </div>
      <slot></slot>
    </el-card>
  </el-col>
</template>

<script>
export default {
  props: {
    title: String,
    height: {
      type: String,
      default: 'auto'
    },
    col: {
      type: Number,
      default: 24
    },
    saveButton: {
      type: String
    },
    ifbutton: {
      type: Boolean,
      default: true
    }
  },
  computed: {
    cardStyle() {
      return {
        height: this.height
      }
    }
  }
}
</script>

<style lang="stylus" scoped>
  .clearfix:before,
  .clearfix:after
    display table
    content ""
  .clearfix:after
    clear both
</style>
